<?php

namespace app\index\command;
use app\index\controller\Task;
use app\index\controller\Crontask;
use think\console\Input;
use think\console\Output;

/**
 * issue()方法由系统Cli定期调用，执行周期性计划任务，实现道具及邮件定期发送
 */
class Issue extends Crontask
{

    //配置描述
    protected function configure()
    {
        $this->setName('issue')

            ->setDescription('Issue Mail/Property');
    }
    /**
     * 邮件及道具定期发放
     * @return   void
     */
    protected function execute(Input $input, Output $output)
    {

        try {

            //日志目录
            $this->logInit('issue');

            //定时执行邮件发放
            //
            $this->task = new Task();
            $this->task->doIssue();

            //$this->task = new \app\index\model\Task();
            //$this->task->issueMailByAppointedTime();

        } catch (\Exception $e) {

            throw new \think\Exception('异常消息:' . $e->getMessage());
        }
    }
}
